/*
@data: 2023/7/23
@author: North
@desc: test
*/
package main

var bills = []int{5,5,5,10,5,5,10,20,20,20}
func main() {
	println(lemonadeChange(bills))
}

func lemonadeChange(bills []int) bool {
	five,ten := 0,0
	for _,num := range bills{
		if num == 5 {
			five += 1
		}else if num == 10 {
			ten += 1
			if five > 0 {
				five -= 1
			}else {
				return false
			}
		}else if num == 20 {
			if five > 0 && ten >0 {
				five -= 1
				ten -= 1
			}else if five >=3 {
				five -= 3
			}else {
				return false
			}
		}
	}
	return true
}
